package number_operatation.nowcoder.easy;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 求连续最大bit数
 * https://www.nowcoder.com/practice/4b1658fd8ffb4217bc3b7e85a38cfaf2?
 * tpId=37&&tqId=21309&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 * @date 2022/5/6 22:01
 **/
public class CountContinueBit {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int num = in.nextInt();
            int bit = 1;
            int prev = 0,max = 0;
            while(bit <= num){
                if((bit & num) != 0)
                    prev += 1;
                else
                    prev = 0;
                max = Math.max(prev,max);
                bit <<= 1;
            }
            System.out.println(max);
        }
    }
}
